<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //判断字符串是否含有某些字符
    console.log('abc'.includes('bc'));
    //第二个参数 表示搜索位置 不填默认从0开始
    console.log('abab'.includes('b', 3));
    let url = 'https://www.baidu.com/';
    const addURLParam = (url, name, value) => {
      url += url.includes('?') ? '&' : '?'
      url += `${name}=${value}`
      return url
    }
    url = addURLParam(url, 'name', 'aa');
    console.log(url);
  </script>
</body>

</html>